package shared.message

trait Message extends java.io.Serializable {
  val timestamp = new java.util.Date()
}

object Message {
  private val IDGEN = new java.util.concurrent.atomic.AtomicLong(System.currentTimeMillis)
  
  def nextId = IDGEN.getAndIncrement
  
  def previousId = IDGEN.get
  
}

trait IdentifiedMessage[R <: ResponseMessage] extends Message {
  
  val id = Message.nextId
  
}

trait ResponseMessage extends Message {
  val responseTo: Long
}